
import request from '@/api/index.js'
const state = {
	bannerList:{},
	navList:{},
	floorList:{}
}
const mutations = {
	//轮播图
	SET_BANNER(state,bannerList){
		state.bannerList = bannerList
	},
	// 导航栏
	SET_NAVDATA(state,navList){
		state.navList = navList
	},
	//楼层floor
	SET_FLOORLIST(state,floorList){
		state.floorList = floorList
	}
}
const actions = {
	//轮播图
	async getBannerData({commit}){
		const result = await request('/home/swiperdata')
		commit('SET_BANNER',result)
	},
	// 导航栏
	async getnavDataList({commit}){
		const result = await request('/home/catitems')
		commit('SET_NAVDATA',result)
	},
	//楼层
	async getfloorData({commit}){
		const result = await request('/home/floordata')
		console.log('---->',result);
		commit('SET_FLOORLIST',result)
	}
}
const getters = {
	bannerListData(state){
		return state.bannerList.message||[]
	},
	navListData(state){
		return state.navList.message||[]
	},
	floorListData(state){
		// return (state.floorList.message||[]).floor_title||{}
		return (state.floorList.message) || []
	},
}

export default{
	namespaced:true,
	state,
	mutations,
	actions,
	getters
}